9^3 cubes

Nikolaus Gradwohl2012-05-25T04:51:08+00:00

The cubes and the animation keyframes were generated using a python script

you can download the blend file here

cubes

import bpy

def run():
    px = -8
    py = -8
    pz = -8

    mat = bpy.data.materials['Material']

    bpy.ops.anim.change_frame( frame = 1 )

    nodes = [[[ 0 for i in range(9)] for j in range(9)] for k in range(9)]

    for x in range(9):
        for y in range(9):
            for z in range(9):
                bpy.ops.mesh.primitive_cube_add( location=(px+x*2,py+y*2,pz+z*2))
                bpy.ops.anim.keyframe_insert_menu( type='Location' )
                nodes[x][y][z] = bpy.context.active_object
                nodes[x][y][z].data.materials.append( mat )

    bpy.ops.anim.change_frame( frame = 50 )
    for x in range(3):
        for y in range(3):
            for z in range(3):

                for i in range(3):
                    for j in range(3):
                        for k in range(3):

                            n = nodes[x*3+i][y*3+j][z*3+k]
                            bpy.context.scene.objects.active = n
                            n.select = True
                            n.location=((x - 1.5) * 15+(i)*2+5.5, (y -1.5)*15+(j)*2+5.5, (z-1.5)*15+(k)*2+5.5)
                            bpy.ops.anim.keyframe_insert_menu( type='Location' )

    bpy.ops.anim.change_frame( frame = 100 )

    px = -20
    py = -20
    pz = -20
    for x in range(9):
        for y in range(9):
            for z in range(9):
                n = nodes[x][y][z]
                bpy.context.scene.objects.active = n
                n.select = True
                n.location=(px+5*x, py+5*y, pz+5*z)
                bpy.ops.anim.keyframe_insert_menu( type='Location' )
                bpy.ops.anim.keyframe_insert_menu( type='Rotation' )


    bpy.ops.anim.change_frame( frame = 150 )

    for x in range(9):
        for y in range(9):
            for z in range(9):
                n = nodes[x][y][z]
                bpy.context.scene.objects.active = n
                n.select = True
                n.rotation_euler=(0,3.14/4,3.14/4)
                bpy.ops.anim.keyframe_insert_menu( type='Location' )
                bpy.ops.anim.keyframe_insert_menu( type='Rotation' )

    bpy.ops.anim.change_frame( frame = 200 )

    for x in range(3):
        for y in range(3):
            for z in range(3):

                for i in range(3):
                    for j in range(3):
                        for k in range(3):

                            n = nodes[x*3+i][y*3+j][z*3+k]
                            bpy.context.scene.objects.active = n
                            n.select = True
                            n.location=((x - 1.5) * 15+(i)*2+5.5, (y -1.5)*15+(j)*2+5.5, (z-1.5)*15+(k)*2+5.5)
                            n.rotation_euler=(0,0,3.14/2)
                            bpy.ops.anim.keyframe_insert_menu( type='Location' )
                            bpy.ops.anim.keyframe_insert_menu( type='Rotation' )


    bpy.ops.anim.change_frame( frame = 250 )
    px = -8
    py = -8
    pz = -8
    for x in range(9):
        for y in range(9):
            for z in range(9):
                n = nodes[x][y][z]
                bpy.context.scene.objects.active = n
                n.select = True
                n.location=(px+2*x, py+2*y, pz+2*z)
                bpy.ops.anim.keyframe_insert_menu( type='Location' )
                bpy.ops.anim.keyframe_insert_menu( type='Rotation' )


if __name__ == "__main__":
    run()
Tweet This! submit to reddit Digg! Tags: | no comments | no trackbacks

See also:

blender labyrinth generator
flying through the menger-sponge
grease pencil experiment 6 - grid
grease pencil experiment 4 - filled shapes
grease pencil experiment 4 - depth of field

Trackbacks

Comments

Leave a response

Leave a comment